home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 1833 / 1833.xpi / components / yoonoAbout.js < prev    next >
Text File  |  2009-12-16  |  2KB  |  70 lines

  1. // XPCOM stuff
  2. const SERVICE_NAME="About Yoono Page (or, Yoono About)";
  3. const SERVICE_CID = Components.ID("{3c4de21f-22c9-4e8a-bc16-f8e2a69e3707}");
  4. const SERVICE_CTRID = "@mozilla.org/network/protocol/about;1?what=yoono";
  5. const SERVICE_CONSTRUCTOR = YoonoAbout;
  6.  
  7. const CC = Components.classes;
  8. const CI = Components.interfaces;
  9.  
  10. function YoonoAbout() {
  11. }
  12.  
  13. YoonoAbout.prototype = {
  14.     newChannel : function(aURI) {
  15.         var ios = CC["@mozilla.org/network/io-service;1"].
  16.                   getService(CI.nsIIOService);
  17.  
  18.         var channel = ios.newChannel(
  19.           "chrome://yoono/content/aboutyoono.xul",
  20.           null,
  21.           null
  22.         );
  23.  
  24.         channel.originalURI = aURI;
  25.         return channel;
  26.     },
  27.  
  28.     getURIFlags: function(aURI) {
  29.         return CI.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT;
  30.     }
  31.  
  32. }
  33.  
  34. // XPCOM registration
  35. var Module = {
  36.     registerSelf : function (compMgr, fileSpec, location, type) {
  37.         // enregistrement
  38.         compMgr.QueryInterface(CI.nsIComponentRegistrar).
  39.         registerFactoryLocation(SERVICE_CID, SERVICE_NAME, SERVICE_CTRID, fileSpec, location, type);
  40.     },
  41.     unregisterSelf : function(compMgr, fileSpec, location) {
  42.         // desenregistrement
  43.         compMgr.QueryInterface(CI.nsIComponentRegistrar)
  44.         .unregisterFactoryLocation(SERVICE_CID, fileSpec);
  45.     },
  46.     getClassObject : function (compMgr, cid, iid) {
  47.         if(cid.equals(SERVICE_CID)) {
  48.             return  {  // nsIFactory
  49.                 createInstance: function (outer, iid) {
  50.                     if (outer != null) throw Components.results.NS_ERROR_NO_AGGREGATION;
  51.                     return new SERVICE_CONSTRUCTOR();
  52.                 }
  53.             };
  54.         }
  55.  
  56.         if (!iid.equals(CI.nsIFactory))
  57.         throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
  58.  
  59.         throw Components.results.NS_ERROR_NO_INTERFACE;
  60.     },
  61.     canUnload : function(compMgr) {
  62.         return true;
  63.     }
  64. };
  65. function NSGetModule(compMgr, fileSpec) {
  66.     return Module;
  67. }
  68.  
  69.  
  70.